home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 108 / gp2demo.iso / multimed / simpdemo / SIMPSONS / SUPPORT / DLOGDATA / EXPORT.DXR / 00002_exportDialogBox parent.ls < prev    next >
Encoding:
Text File  |  1980-01-01  |  7.1 KB  |  212 lines

  1. property exportButton, transformButton, cancelButton, fileIndex, theNumberOfFiles, theContentList
  2. global exportDialogBox, theScrollBar, fileMgr, toonDataFileList, PCflag, creditsEdited
  3.  
  4. on birth me
  5.   set exportButton to 2
  6.   set transformButton to 3
  7.   set cancelButton to 4
  8.   puppetSprites(openButton, cancelButton, 1)
  9.   puppetSprites(20, 33, 1)
  10.   puppetSprite(48, 1)
  11.   set creditsEdited to 0
  12.   if PCflag then
  13.     set the textFont of field "filename field" to "Arial"
  14.     set the textSize of field "filename field" to 10
  15.     set the textStyle of field "filename field" to "bold"
  16.     set the textFont of field "credits field" to "Arial"
  17.     set the textSize of field "credits field" to 9
  18.     set the textStyle of field "credits field" to "bold"
  19.     set the textFont of field "file info field" to "Arial"
  20.     set the textSize of field "file info field" to 9
  21.     set the textStyle of field "file info field" to "bold"
  22.     set the textFont of field "cartoonSize field" to "Arial"
  23.     set the textSize of field "cartoonSize field" to 9
  24.     set the textStyle of field "cartoonSize field" to "bold"
  25.   else
  26.     set the textFont of field "filename field" to "Geneva"
  27.     set the textSize of field "filename field" to 10
  28.     set the textStyle of field "filename field" to "bold"
  29.     set the textFont of field "credits field" to "Geneva"
  30.     set the textSize of field "credits field" to 9
  31.     set the textStyle of field "credits field" to "bold"
  32.     set the textFont of field "file info field" to "Geneva"
  33.     set the textSize of field "file info field" to 9
  34.     set the textStyle of field "file info field" to "bold"
  35.     set the textFont of field "cartoonSize field" to "Geneva"
  36.     set the textSize of field "cartoonSize field" to 9
  37.     set the textStyle of field "cartoonSize field" to "bold"
  38.   end if
  39.   return me
  40. end
  41.  
  42. on init me
  43.   set theNumberOfFiles to count(toonDataFileList)
  44.   set fileIndex to theNumberOfFiles
  45.   set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
  46.   set the text of field "filename field" to getAt(toonDataFileInfo, 1)
  47.   set the text of field "credits field" to getAt(toonDataFileInfo, 2)
  48.   set the text of field "cartoonSize field" to getCartoonSize(me, getAt(toonDataFileInfo, 3))
  49.   set theContentList to getAt(toonDataFileInfo, 4)
  50.   showThumbnails(me)
  51.   if theNumberOfFiles > 1 then
  52.     enable(theScrollBar)
  53.   else
  54.     disable(theScrollBar)
  55.   end if
  56.   updateFileInfoField(me)
  57.   updateStage()
  58. end
  59.  
  60. on updateFileInfoField me
  61.   put "Cartoon" && fileIndex && "out of" && theNumberOfFiles into field "file info field"
  62. end
  63.  
  64. on handleButton me, whichSprite
  65.   if hiliteButton(whichSprite) then
  66.     if whichSprite = exportButton then
  67.       exportCartoon(me)
  68.     else
  69.       if whichSprite = transformButton then
  70.         exportToonData(me)
  71.       else
  72.         if whichSprite = cancelButton then
  73.           hide(me)
  74.         end if
  75.       end if
  76.     end if
  77.   end if
  78. end
  79.  
  80. on incrementFilePointer me
  81.   if fileIndex < count(toonDataFileList) then
  82.     set fileIndex to fileIndex + 1
  83.     set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
  84.     set the text of field "filename field" to getAt(toonDataFileInfo, 1)
  85.     set the text of field "credits field" to getAt(toonDataFileInfo, 2)
  86.     set the text of field "cartoonSize field" to getCartoonSize(me, getAt(toonDataFileInfo, 3))
  87.     set theContentList to getAt(toonDataFileInfo, 4)
  88.     showThumbnails(me)
  89.     updateFileInfoField(me)
  90.     update(theScrollBar)
  91.     updateStage()
  92.   end if
  93. end
  94.  
  95. on decrementFilePointer me
  96.   if fileIndex > 1 then
  97.     set fileIndex to fileIndex - 1
  98.     set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
  99.     set the text of field "filename field" to getAt(toonDataFileInfo, 1)
  100.     set the text of field "credits field" to getAt(toonDataFileInfo, 2)
  101.     set the text of field "cartoonSize field" to getCartoonSize(me, getAt(toonDataFileInfo, 3))
  102.     set theContentList to getAt(toonDataFileInfo, 4)
  103.     showThumbnails(me)
  104.     updateFileInfoField(me)
  105.     update(theScrollBar)
  106.     updateStage()
  107.   end if
  108. end
  109.  
  110. on hide me
  111.   set the modal of exportDialogBox to 0
  112.   forget(exportDialogBox)
  113. end
  114.  
  115. on exportCartoon me
  116.   tell the stage
  117.     makeCartoonForPlayer(fileMgr, fileIndex)
  118.   end tell
  119.   hide(me)
  120. end
  121.  
  122. on exportToonData me
  123.   set theCartoonName to getAt(getAt(toonDataFileList, fileIndex), 1)
  124.   tell the stage
  125.     exportToonData(fileMgr, fileIndex, theCartoonName)
  126.   end tell
  127.   hide(me)
  128. end
  129.  
  130. on update me, direction
  131.   if ((fileIndex + direction) <> 0) and ((fileIndex + direction) <= theNumberOfFiles) then
  132.     set fileIndex to fileIndex + direction
  133.     set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
  134.     set the text of field "filename field" to getAt(toonDataFileInfo, 1)
  135.     set the text of field "credits field" to getAt(toonDataFileInfo, 2)
  136.     set the text of field "cartoonSize field" to getCartoonSize(me, getAt(toonDataFileInfo, 3))
  137.     set theContentList to getAt(toonDataFileInfo, 4)
  138.     showThumbnails(me)
  139.     updateFileInfoField(me)
  140.     update(theScrollBar)
  141.     updateStage()
  142.   end if
  143. end
  144.  
  145. on getCurrentFileNumber me
  146.   return fileIndex
  147. end
  148.  
  149. on getTheNumberOfFiles me
  150.   return theNumberOfFiles
  151. end
  152.  
  153. on getCartoonSize me, sizeInBytes
  154.   set theCartoonSize to sizeInBytes
  155.   if theCartoonSize < 1000 then
  156.     return theCartoonSize & "K"
  157.   else
  158.     set theCartoonSize to string(theCartoonSize / 1000.0)
  159.     set the itemDelimiter to "."
  160.     set theParsedSize to item 1 of theCartoonSize
  161.     put "." after theParsedSize
  162.     put char 1 of item 2 of theCartoonSize after theParsedSize
  163.     set the itemDelimiter to ","
  164.     set theCartoonSize to theParsedSize
  165.     return theCartoonSize & "MB"
  166.   end if
  167. end
  168.  
  169. on showThumbnails me
  170.   set positionTable to [[54, 54], [90, 54], [90, 90], [54, 90], [18, 90], [18, 54], [18, 18], [54, 18], [90, 18], [126, 18], [126, 54], [126, 90]]
  171.   set bgdThumbnail to getAt(theContentList, 1) & ".thumb"
  172.   set the loc of sprite 20 to point(94, 84)
  173.   set the castNum of sprite 20 to the number of cast bgdThumbnail
  174.   set listOfCharacters to getAt(theContentList, 2)
  175.   set thumbnailSprite to 21
  176.   set numberOfCharacters to count(listOfCharacters)
  177.   repeat with i = 1 to 12
  178.     if i <= numberOfCharacters then
  179.       set castThumbnail to getAt(listOfCharacters, i)
  180.       set thePoints to getAt(positionTable, i)
  181.       set x to the left of sprite 20 + getAt(thePoints, 1)
  182.       set y to the top of sprite 20 + getAt(thePoints, 2)
  183.       set the loc of sprite thumbnailSprite to point(x, y)
  184.       set the castNum of sprite thumbnailSprite to the number of cast (castThumbnail & ".thumb")
  185.     else
  186.       set the loc of sprite thumbnailSprite to point(-1000, 18)
  187.     end if
  188.     set thumbnailSprite to thumbnailSprite + 1
  189.   end repeat
  190. end
  191.  
  192. on clickedPreview me
  193.   if creditsEdited then
  194.     updateCredits(me)
  195.     set creditsEdited to 0
  196.   else
  197.     exportCartoon(me)
  198.   end if
  199. end
  200.  
  201. on updateCredits me
  202.   set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
  203.   set oldCartoonCredits to getAt(toonDataFileInfo, 2)
  204.   set newCartoonCredits to the text of field "credits field"
  205.   setAt(getAt(toonDataFileList, fileIndex), 2, newCartoonCredits)
  206.   if newCartoonCredits <> oldCartoonCredits then
  207.     tell the stage
  208.       updateToonData(fileMgr, fileIndex, newCartoonCredits, #EXPORT)
  209.     end tell
  210.   end if
  211. end
  212.